package in.andante.android.Hello_World;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;


/* 
public class Hello_WorldActivity extends Activity implements OnClickListenerkListener { 
    ///** Called when the activity is first created. 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn = (Button)findViewById(R.id.button1);   
        btn.setText("please,click");   
        btn.setOnClickListener(this);   

        
        //TextView _helloWorldWord = new TextView(this);
        //_helloWorldWord.setText("Hello World!");
        //setContentView(_helloWorldWord);
        
        
    }
    private Button btn;   
    
    @Override   
    public void onClick(View v){   
    	int count=0;
        TextView _helloWorldWord = new TextView(this);
       if(v == btn){
    	   if(0 == count ) {
    		   _helloWorldWord.setText("Hello World !");
    		   count = 1;
    	   }
    	   else {
    		   _helloWorldWord.setText("");
    		   count = 0;
    	   }
		   setContentView(_helloWorldWord);  	   
        }   
    }   
 
}
*/

//public class Hello_WorldActivity extends Activity implements OnClickListener {
public class Hello_WorldActivity extends Activity{
    /** Called when the activity is first created. */   
    private Button btn; 
    private TextView display;
    private int count=0;
    
    @Override   
    public void onCreate(Bundle savedInstanceState) {   
        super.onCreate(savedInstanceState);   
        setContentView(R.layout.main);   
        //TextView _helloWorldWord = new TextView(this);
        //_helloWorldWord.setText("Hello World!");
        //setContentView(_helloWorldWord);

        btn = (Button) this.findViewById(R.id.button1);   
        btn.setText("please,click");   
        display = (TextView) this.findViewById(R.id.textView1);
        display.setText("");
        
        btn.setOnClickListener(new clickEvents());
    }   
   

    private class clickEvents implements OnClickListener {
    	@Override
    	public void onClick(View v){   
    	    if(v == btn){
    	       if(0 == count ) {
    	    	   display.setText("Hello World !");
    	    	   count = 1;
    	       }
    	       else {
    	    	   display.setText("");
    	    	   count = 0;
    	       }
    	    }   
        }
    }
    
/*
    @Override   
      public void onClick(View v){   

       if(v == btn){
    	   if(0 == count ) {
    		   display.setText("Hello World !");
    		   count = 1;
    	   }
    	   else {
    		   display.setText("");
    		   count = 0;
    	   }
        }   
    }   
*/  
}  
